package com.chushouya.manager.constants;


import com.general.framework.core.enums.IEnum;

/**
 * 红包发放类型
 */
public enum BonusTypeSendTypeEnum implements IEnum<Integer> {

    USER(1, "按用户发放"),
    GOODS(2, "按商品发放"),
    ORDER_PRICE(3, "按订单金额发放"),
    OFFLINE(4, "线下发放的红包");

    private final Integer value;
    private final String desc;

    BonusTypeSendTypeEnum(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer value() {
        return value;
    }

    @Override
    public String named() {
        return desc;
    }

    public static String getDesc(Integer value) {
        if (value == null) {
            return null;
        }
        for (BonusTypeSendTypeEnum type : values()) {
            if (value.equals(type.value)) {
                return type.desc;
            }
        }
        return "";
    }
}
